// pages/Home/ruleRegulation/ruleRegulation.js
var businessLogic = require('../../../utils/NetWork/Model/HomebusinessLogic.js')
var WxParse = require('../../../utils/Component/wxParse/wxParse.js');
var common = require('../../../utils/common.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    list: [],
    content: [],
    openPicker: false,
    needAnimation: false,
    contentHeight: 0,
    rule: false,
  },
  onPickHeaderClick: function () {
    this.setData({
      openPicker: !this.data.openPicker,
      needAnimation: true
    })
    let params = { "orgid":"999999999", "userid": this.data.userid, "pageSize": 100, "nowPage": 1 };
    businessLogic.SchoolList(params, (res) => {
      this.setData({
        list: res
      });
    });
  },
  onPageClick: function () {
    if (this.data.openPicker == true) {
      this.setData({
        openPicker: false,
        needAnimation: false
      })
    }
  },
  tiaozhuan: function (e) {
    var index = e.currentTarget.dataset.index
    if (index == 0) {
      wx.navigateTo({
        url: "../schoolProfile/schoolProfile"
      });
    }
    else if (index == 1) {
      wx.navigateTo({
        url: "../schoolScenery/schoolScenery"
      });
    }
    else if (index == 2) {
      wx.navigateTo({
        url: "../ruleRegulation/ruleRegulation"
      });
    }
    else if (index == 3) {
      wx.navigateTo({
        url: "../currentLeader/currentLeader"
      });
    }
    else if (index == 4) {
      wx.navigateTo({
        url: "../sucessLeader/sucessLeader"
      });
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var orgid = common.getStorageSync("orgid")
    var userid = common.getStorageSync("userid")
    this.setData({
      orgid: orgid,
      userid: userid
    });
    this.ruleRegulation()
  },
  ruleRegulation: function () {
    let params = { "page": 1, "num": 1000, "orgid": this.data.orgid, "userid": this.data.userid, "searchField": "orgid", "searchValue": this.data.orgid };
    businessLogic.RegulationsList(params, (res) => {
      var article = res.content;
      var that = this;
      WxParse.wxParse('article', 'html', article, that, 5);
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    wx.reLaunch({
      url: "../microweb/microweb"
    })
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})